package com.bit.cfdi.web.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import com.bit.cfdi.web.dao.EmailDAO;
import com.bit.cfdi.web.domain.Contacto;
import com.bit.cfdi.web.domain.Email;
@Service
public class EmailService {

	@Autowired EmailDAO emailDAO;
	
	public void save(Email email) throws DataAccessException {
		emailDAO.save(email);

	}

	public Email getById(Long id) throws DataAccessException {
		return emailDAO.getById(id);
	}

	public List<Email> getAll() throws DataAccessException {
		return emailDAO.getAll();
	}
	
	public List<Email> getFromContacto(final Contacto contacto) 
			throws DataAccessException {
		
		return emailDAO.getFromContacto(contacto);
	}
	
	public void deleteFromContacto(final Contacto contacto) 
			throws DataAccessException {
		emailDAO.deleteFromContacto(contacto);
	}

}
